package com.github.dreamyoung.mprelation.demo.controller;

import com.github.dreamyoung.mprelation.AutoMapper;
import com.github.dreamyoung.mprelation.demo.entity.Grade;
import com.github.dreamyoung.mprelation.demo.service.GradeService;
import com.github.dreamyoung.mprelation.demo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author lxl
 * @date 2022/4/10
 */
@RestController
@RequestMapping("/grade")
public class GradeController {
    @Autowired
    private GradeService gradeService;
    @Autowired
    private AutoMapper autoMapper;
    @RequestMapping("/oneTomany")
    public Object  oneTomany(){
        List<Grade> gradeList=gradeService.list();
        autoMapper.mapperEntityList(gradeList,"studentList");
        return gradeList;
    }
}
